feat(hosts): add Pi coding agent host adapter - #25
Conversation
There was a problem hiding this comment.
Pull request overview
Adds first-class support for the Pi coding-agent host (pi.dev, @earendil-works/pi-coding-agent) by introducing a new Pi session-analysis adapter, a Pi agent-customize inventory provider, and the pi-package discovery surfaces (manifest + /better-harness prompt template). This aligns with the repo’s host-boundary approach where host differences live in the adapter matrix, configured-asset providers, session adapters, and output modes.
Changes:
- Add Pi session evidence adapter (
--platform pi) with JSONL v3 parsing and workspace scoping. - Add Pi configured-asset inventory provider and wire
piinto harness/evidence-bundle/task-loop/report CLI surfaces. - Ship a
pimanifest +prompts/template in the npm package; update docs/README/changelog and add tests.
Reviewed changes
Copilot reviewed 49 out of 49 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| test/session-analysis-providers.test.mjs | Adds Pi analyzer coverage and Pi transcript fixtures. |
| test/scripts-refactor-contract.test.mjs | Updates frozen CLI output hashes after new platform. |
| test/plugin-manifests.test.mjs | Verifies package.json.pi and prompts/ packaging rules. |
| test/fixtures/scripts-refactor-contract/session-help.txt | Updates help fixture to include pi. |
| test/fixtures/scripts-refactor-contract/root-help.txt | Updates root help fixture to mention Pi. |
| test/coding-agent-platform-notes.test.mjs | Ensures sessions diagnostics notes include Pi paths. |
| test/better-harness-evidence-bundle.test.mjs | Adds Pi agentCustomize lane routing test. |
| test/agent-customize.test.mjs | Adds Pi inventory/provider tests and fixtures. |
| test/agent-customize-architecture.test.mjs | Updates architecture doc expectations for “six metadata roots”. |
| test/agent-asset-baseline.test.mjs | Adds Pi asset baseline fixture test. |
| scripts/session-analysis/usage-summary.mjs | Extends --platform usage to include pi. |
| scripts/session-analysis/selection-profile.mjs | Extends --platform usage to include pi. |
| scripts/session-analysis/platforms/pi.mjs | Implements Pi session discovery + normalization (new). |
| scripts/session-analysis/lifecycle-demand-signals.mjs | Allows pi in host-safe normalization. |
| scripts/session-analysis/analyzer.mjs | Wires Pi platform loader + help strings. |
| scripts/session-analysis.mjs | Wires Pi platform loader + help strings (shim). |
| scripts/npm-package/verify-pack.mjs | Requires prompt template in package and forbids it in runtime bundle. |
| scripts/harness-analysis/task-loop-source.mjs | Accepts pi platform; threads pi-home through evidence collection. |
| scripts/harness-analysis/task-loop-report.mjs | Recognizes pi in platform selection. |
| scripts/harness-analysis/report-run.mjs | Accepts pi and --pi-home for report runs. |
| scripts/harness-analysis/report-quality.mjs | Adds Pi to session-scope detection patterns. |
| scripts/harness-analysis/evidence-bundle/contract.mjs | Adds pi to allowed providers. |
| scripts/harness-analysis/evidence-bundle/cli.mjs | Accepts --pi-home and pi platform. |
| scripts/harness-analysis/evidence-bundle/agent-customize.mjs | Enables Pi for agentCustomize lane. |
| scripts/coding-agent-practices/inventory.mjs | Accepts pi and includes piHome in scope. |
| scripts/coding-agent-practices/asset-integrity.mjs | Accepts pi provider. |
| scripts/coding-agent-practices/asset-baseline.mjs | Accepts pi provider. |
| scripts/better-harness-cli/registry.mjs | Updates session-analysis command summary to include Pi. |
| scripts/agent-lint/cli.mjs | Allows `--provider ... |
| scripts/agent-customize/providers/pi.mjs | Implements Pi configured-asset inventory (new). |
| scripts/agent-customize/providers/index.mjs | Registers Pi provider collector. |
| scripts/agent-customize/cli.mjs | Threads --pi-home through CLI. |
| references/session-evidence/sessions-diagnostics.md | Adds Pi platform notes for session evidence diagnostics. |
| references/agent-customize/routing.md | Adds Pi asset routing guidance. |
| references/agent-customize/README.md | Adds Pi platform notes link. |
| references/agent-customize/platforms/pi.md | Adds Pi operating-practice reference (new). |
| README.zh-CN.md | Documents Pi installation and report usage (zh-CN). |
| README.md | Documents Pi installation and report usage (en). |
| prompts/better-harness.md | Adds /better-harness prompt template (new). |
| package.json | Adds pi manifest + pi-package keyword + ships prompts/. |
| docs/i18n/zh-Hans/docusaurus-plugin-content-docs/current/hosts/adapter-matrix.md | Adds Pi to host adapter matrix (zh-Hans). |
| docs/glossary.md | Updates session-analysis + host shell glossary entries for Pi. |
| docs/docs/hosts/adapter-matrix.md | Adds Pi to host adapter matrix (en docs site). |
| docs/concepts.md | Updates session-evidence concept to include Pi. |
| docs/community.md | Updates “host shell and packaging” to include Pi manifest. |
| docs/ARCHITECTURE.md | Updates “five” → “six” plugin metadata roots wording. |
| docs/adrs/directory-structure.md | Updates platform adapter list and packaging roots count. |
| docs/adapters/README.md | Adds Pi row and discovery/evidence notes. |
| CHANGELOG.md | Records Pi host support under Unreleased. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
phodal
left a comment
There was a problem hiding this comment.
I ran an isolated native smoke with @earendil-works/pi-coding-agent@0.83.0 and compared Pi's own resolver/session behavior with this adapter.
What already works:
pi install/pi listaccepts this package.- Pi's
DefaultPackageManagerresolves exactly the canonicalbetter-harnessSkill and prompt from the package manifest. npm run checkpasses locally: 874/874 tests plus pack verification.
There are still native-contract blockers in the inline comments below. In addition, please update the branch before merge:
- Rebase onto current
main, which now includes PR #22 and PR #23. At this head,git merge-treereports 37 content conflicts. Resolve host registries as a union so Copilot support is retained while Pi is added. - Add a dated Pi host spec under
docs/specs/with stable acceptance IDs, and link the new Coding Agent contribution guide. The guide links PR #6 and PR #22 as reviewed examples. - Amend the commit with the required single
Co-authored-byline. - Re-run CI after updating the head. The current run is
action_requiredwith no jobs, so it is not green CI.
One environment note: the local suite ran under Node 26, outside the repository's declared Node range. The passing local suite is useful evidence but should not replace CI on a supported runtime.
Add Pi (pi.dev / @earendil-works/pi-coding-agent) as an analysis-capable source-local host, following the host contribution guide and the Qwen Code / GitHub Copilot host template. Native contracts were verified against @earendil-works/pi-coding-agent; a dated spec lives at docs/specs/2026-07-30-pi-host-support.md (pi-host-support) with stable PHS-AC acceptance ids. - Distribution shell: `pi` manifest in package.json plus a /better-harness prompt template, so `pi install <repo>` discovers the canonical skills/ root and registers the slash command. Pi reuses the existing package.json, so the package still ships six host metadata roots and the Qoder runtime bundle stays Qoder-only. - Configured assets: scripts/agent-customize/providers/pi.mjs inventories settings-declared pi packages, extensions, skills, prompt templates, and AGENTS.md context. It honors Pi's effective state -- autoload:false fails closed, and per-resource allowlists, `!` exclusions, and `+`/`-` overrides narrow reported resources -- and models piHome and the real user home independently so ~/.agents/skills is found under a relocated PI_CODING_AGENT_DIR. - Session evidence: scripts/session-analysis/platforms/pi.mjs reads workspace-matching JSONL v3 transcripts, resolves the session directory as CLI > env > settings > default, treats a custom session directory as the exact flat JSONL directory qualified by the session-header cwd, gates default-tree root existence on a workspace-keyed directory, and keeps partial/malformed usage explicit instead of zero-filling. - Register `pi` across the supported-platform set and --pi-home threading; the A-06 consistency test now covers seven hosts. - Sync the host adapter matrix, site docs (en/zh), references, READMEs, and CHANGELOG; add provider, session, autoload/filter, relocated-home, custom-dir, precedence, usage, and prompt-template expansion tests. Validated with npm run check (896 tests, pack verification) and against real local Pi data. Co-authored-by: QoderAI (Pi) <qoder_ai@qoder.com>
430f214 to
af5a6c6
Compare
|
Thanks for the thorough native smoke and the four blocking findings — all addressed, and the branch is updated for merge. Inline threads (all resolved):
Branch updates:
Local verification on this head: |
Resolve PR QoderAI#25 against the current public-host entrypoint contract while keeping Pi as an analysis-capable source-local host outside the public Quickstart set until an end-to-end interactive report render is observed. The integration review hardens normalized package identity and effective resource filters, session-header and workspace isolation, relative session roots, provider-home propagation, prompt frontmatter, and canonical HTML report routing. It also keeps the six filesystem metadata roots distinct from Pi's package.json manifest. Validated with npm run check (913 tests plus package verification), the documentation link graph, focused Pi provider tests, git diff --check, and pack verification from a materialized staged index. Co-authored-by: Codex (GPT 5.6 Sol) <codex@openai.com>
|
Maintainer review follow-up:
The interactive Pi report-render smoke remains explicitly Unobserved and is not claimed by this merge. |
Summary
Pi (pi.dev,
@earendil-works/pi-coding-agent) can now run/better-harnessas a first-class host:pi install <repo>discovers the skill and a/better-harnessprompt template, and reviews on Pi gain real configured-asset and session evidence instead ofunobservedlanes.Why
Traceability and Scope
docs/adapters/README.mdhost-boundary contract (host differences enter only the matrix, configured-asset providers, session adapters, and output modes).--platform piaccepted across session-analysis, evidence-bundle, asset-baseline/integrity, task-loop, report-run, and agent-lint;pi install/pi -ediscovery works from the repository root.scripts/agent-customize/providers/pi.mjsandscripts/session-analysis/platforms/pi.mjs(new), platform registration lists acrossscripts/,package.json(pimanifest,prompts/packaging),prompts/better-harness.md,references/agent-customize/platforms/pi.md, adapter-matrix docs (en/zh), READMEs, CHANGELOG.docs/adapters/pi.mdsplit (no split trigger met), no change to the Qoder runtime bundle contents.Change Type
Test and Review Evidence
npm testnpm run pack:verifypackage/prompts/better-harness.md; runtime zip 338 entries withprompts/correctly excludednode scripts/session-analysis.mjs sources --platform pi --workspace /private/tmp(real local Pi data)node scripts/session-analysis.mjs facts --platform pi ...session-core-factswith 2 candidates; no session-id or home-path leakage in outputbetter-harness agent-customize inventory --provider pi(real~/.pi/agent)AGENTS.mdrulesbetter-harness harness evidence-bundle --platform pi --workspace <repo>status: complete; sessionEvidence/projectHarness/agentCustomize + lead all availableDefaultPackageManager.resolveExtensionSources(<repo>)in an isolated agent dirbetter-harness) and 1 prompt template (better-harness.md) from thepimanifestManual or visual evidence: session-format fixtures were derived from real Pi v3 JSONL transcripts and pi 0.83.0 source (
session-manager.jsslug rule,config.jsenv overrides), not from documentation alone.Risk and Recovery
\and:replacement) are covered by unit tests.pimanifest key,pi-packagekeyword, andprompts/;verify-packenforces the new required entry and forbidsprompts/from the Qoder runtime bundle. No schema changes./better-harnessreport run inside an interactive Pi session (model-driven) was not exercised; discovery, evidence collection, and bundle assembly were verified directly. Pi package manifest glob filters and per-resource enable state are declared unsupported rather than inventoried.AI Involvement
Checklist
AGENTS.md,CONTRIBUTING.md, and the relevant canonical-owner guidance.CHANGELOG.md.